home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-12-07 | 1.0 KB | 48 lines | [TEXT/SPM ] |
- /*
- main.cp
-
- This is a sample program based upon the "IC Hello Cruel World" program
- which is intended to show the simplest IC aware C++ program using
- the CInternetConfig class. It simply outputs the Real Name preference.
- */
-
- #include <stdlib.h>
- #include <iostream.h>
-
- #include "IC Types.h"
- #include "IC Keys.h"
-
- #include "CInternetConfig.hpp"
-
- int main(){
- CInternetConfig* ic;
- Str255 str;
- long str_size;
- ICAttr attr;
-
- cout<<"Hello Cruel World C++ Test" << endl;
-
- ic=new CInternetConfig('????');
-
- if (ic->GetLastError()==noErr){
- if (ic->FindConfigFile(0,NULL)==noErr){
- Str255 temp=kICRealName;
-
- str_size=sizeof(Str255);
-
- if (ic->GetPref(temp,&attr,(Ptr)str,&str_size)==noErr){
- // convert pascal to c string
- str[str[0]+1]=0;
- cout << "Real name is " << ((char*)&(str[1]))<< endl;
- } else
- cout << "CInternetConfig::GetPref Error" << endl;
- } else
- cout << "CInternetConfig::FindConfigFile error" << endl;
-
- delete ic;
- } else
- cout << "new CInternetConfig error" << endl;
-
- return 0;
- }
-